package com.tencent.cloud.iov.flow.presenter.impl;

import android.support.annotation.CallSuper;

import com.tencent.cloud.iov.action.IActionListener;
import com.tencent.cloud.iov.flow.presenter.IActionPresenter;

/**
 * 生命周期空实现，并提供行为通知的默认实现
 *
 * @author showxiao
 * @date 2018/8/28
 */
public abstract class BaseActionPresenter implements IActionPresenter {

    private IActionListener mActionListener;

    @Override
    public void onCreate() {

    }

    @Override
    public void setActionListener(IActionListener listener) {
        mActionListener = listener;
    }

    @Override
    public void startLoader() {

    }

    @Override
    public void registerLoader() {

    }

    @Override
    public void unregisterLoader() {

    }

    @Override
    public void stopLoader() {

    }

    @CallSuper
    @Override
    public void onDestroy() {
        mActionListener = null;
    }

    @Override
    public final void onAction(String actionId, Object... args) {
        if (mActionListener != null) {
            mActionListener.onAction(actionId, args);
        }
    }
}
